#!/usr/bin/perl
use strict;


open FH, "head.txt";
open FU, "url.txt";

my @head;
my $url;

my $line;
while ($line = <FH>) {
	chomp($line);
	if ($line =~ /:/) {
		push @head, $line;
		print "line+$line\n";
	}
}

while ($line = <FU>) {
	chomp($line);
	if ($line =~ /http/) {
		$url = $line;
	}
}

my $cmd = "";

if (defined($url)) {
	$cmd = "curl  -v \"$url\" ";
	if (scalar(@head)>0) {
		foreach my $idx (0 .. scalar(@head)-1) {
			$cmd .= " -H \"$head[$idx]\" ";
		}
	}
}

print "$cmd";

system($cmd);


